package com.demo.kettle.test.controller;

import com.demo.kettle.test.service.IKettleTestService;
import lombok.extern.slf4j.Slf4j;
import org.pentaho.di.core.exception.KettleException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

/**
 * Kettle 文件执行测试
 *
 * @author yuanzheng
 * @since 2022-022-28
 */
@RestController
@RequestMapping(value = "/kettle222")
@Slf4j
public class KettleTestController {

    @Autowired
    private IKettleTestService kettleTestService;

    @PostMapping(value = {"/job"})
    public String job() throws KettleException, ExecutionException, InterruptedException {
        return kettleTestService.job();
    }

    @PostMapping(value = {"/trans"})
    public String trans() throws KettleException {
        return kettleTestService.trans();
    }

    @PostMapping(value = {"/jobSlave"})
    public String jobSlave() throws Exception {
        return kettleTestService.jobSlave();
    }

    @PostMapping(value = {"/transSlave"})
    public String transSlave() throws Exception {
        return kettleTestService.transSlave();
    }

}

